import { defineStore } from 'pinia'
export const useSystem = defineStore('systemStoreId', {
	state() {
		return {
			sysInfo:{
				// 状态栏高度
				statusBarHeight: 0,
				//屏幕高度
				screenHeight:0,
				//屏幕宽度
				screenWidth:0,
				//底部homeBar高度
				homeBarHeight:0,
				//包含状态栏的高度
				navHeight:0,
				// 不包含状态栏的高度
				navBarHeight:44,
				//除去导航栏和状态栏的页面高度
				pageHeightNoNav:0
			}
		}
	},
	actions: {
		updateSystemInfo() {
			const info = uni.getSystemInfoSync()
			this.sysInfo.screenHeight = info.screenHeight
			this.sysInfo.screenWidth = info.screenWidth
			this.sysInfo.statusBarHeight = info.statusBarHeight
			this.sysInfo.homeBarHeight = info.screenHeight - info.windowHeight
			this.sysInfo.navHeight = info.statusBarHeight + this.sysInfo.navBarHeight
			this.sysInfo.pageHeightNoNav = info.screenHeight - this.sysInfo.navHeight
		}
	}
})